<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %>
<% String path = request.getContextPath();%>
<%@ taglib uri="/WEB-INF/tld/c.tld" prefix="c" %>
<%@ taglib uri="/WEB-INF/tld/fmt.tld" prefix="fmt" %>
<%@ taglib uri="/WEB-INF/tld/ui.tld" prefix="ui" %>
<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <title>优车处置付款方信息</title>
    <jsp:include page="../../import.jsp" flush="true"/>
    <jsp:include page="../assParking/assParkCommon.jsp" flush="true" /><!-- 时间格式转换 -->
</head>
<body class="iframeBody">
<div class="Wrapper">
    <div>
        <form id="recAmtInfo">
            <div class="fieldset1 tabel_col clearFix">
                <div class="Hide">
                    <input name="recAmtId" id="recAmtId" type="text" value="${recAmtVo.id}">
                    <input name="dataId" id="dataId" type="text" value="${dataId}">
                    <input name="dataTypeCd" id="dataTypeCd" type="text" value="${dataTypeCd}">
                </div>
                <div class="fieldBox col_50">
                    <div class="label">银行信息<span class="requiredSymbol">*</span></div>
                    <div class="field">
                        <input name="payerBankNm" id="payerBankNm" type="text" class="ui-textbox" value="${recAmtVo.payerBankNm }" validate="{required:true,stringMaxLength:100}">
                    </div>
                </div>
                <div class="fieldBox col_50">
                    <div class="label">账号信息<span class="requiredSymbol">*</span></div>
                    <div class="field">
                        <input name="payerAccNo" id="payerAccNo" type="text" class="ui-textbox" value="${recAmtVo.payerAccNo }" validate="{required:true,stringMaxLength:50}">
                    </div>
                </div>
                <div class="fieldBox col_50">
                    <div class="label">付款方名称<span class="requiredSymbol">*</span></div>
                    <div class="field">
                        <input name="payerAccNm" id="payerAccNm" type="text" class="ui-textbox" value="${recAmtVo.payerAccNm }" validate="{required:true,stringMaxLength:100}">
                    </div>
                </div>
                <div class="fieldBox col_50">
                    <div class="label">付款金额(元)<span class="requiredSymbol">*</span></div>
                    <div class="field">
                        <input name="payAmt" id="payAmt" type="text" class="ui-textbox" value="<fmt:formatNumber value="${recAmtVo.payAmt==null?null:recAmtVo.payAmt/100}" pattern="0.##"/>" validate="{required:true,amount:true}">
                    </div>
                </div>
                <div class="fieldBox col_50">
                    <div class="label">付款时间<span class="requiredSymbol">*</span></div>
                    <div class="field">
                        <input name="payTmStr" id="payTmStr" type="text" class="ui-datepicker" value="<fmt:formatDate value="${recAmtVo.payTm}" pattern="yyyy-MM-dd"/>" validate="{required:true}">
                    </div>
                </div>
                <div class="fieldBox col_50">
                    <div class="label">到账时间</div>
                    <div class="field">
                        <input name="receivedTmStr" id="receivedTmStr" type="text" class="ui-datepicker" value="<fmt:formatDate value="${recAmtVo.receivedTm}" pattern="yyyy-MM-dd"/>" validate="{required:false}">

                    </div>
                </div>
                <div class="fieldBox col_50">
                    <div class="label">到账金额(元)</div>
                    <div class="field">
                        <input name="receivedAmt" id="receivedAmt" type="text" class="ui-textbox" value="<fmt:formatNumber value="${recAmtVo.receivedAmt==null?null:recAmtVo.receivedAmt/100}" pattern="0.##"/>" validate="{required:false,amount:true}">
                    </div>
                </div>
                <div class="fieldBox col_50">
                    <div class="label">使用金额(元)<span class="requiredSymbol">*</span></div>
                    <div class="field">
                        <input name="useAmt" id="useAmt" type="text" class="ui-textbox" value="<fmt:formatNumber value="${recAmtVo.useAmt==null?null:recAmtVo.useAmt/100}" pattern="0.##"/>" validate="{required:true,amount:true}">
                    </div>
                </div>
            </div>
        </form>
    </div>
</div>
<script type="text/javascript">
    $(function () {
        $("#recAmtInfo").ligerForm({
            validate: true
        });

        frameElement.dialog.onOk = function () {
            var form = liger.get("recAmtInfo");
            if (!form.valid()) {
                $.ligerDialog.SQalert({content: LogUtils.LOG_CMM_MUST_FIX_ITEM_INFO, SQ_type: "warning"});
                return false; //验证不通过，不执行以下代码
            }
            //校验“使用金额”不得超过“来款金额”
            var useAmt = $("#useAmt").val();
            var payAmt = $("#payAmt").val();
            if(useAmt != null && useAmt != '') {
                if(parseFloat(useAmt) > parseFloat(payAmt)) {
                    $.ligerDialog.SQalert({content: "使用金额不能大于付款金额！", SQ_type: "warning"});
                    return false; //验证不通过，不执行以下代码
                }
            }

            var formData = form.getData();
            //formData.id = $("#recAmtId").val();
            var wait_dialog = null;
            $.ajax({
                type: 'post',
                dataType: 'json',
                data: formData,
                url: '<%=path%>/ass/ucardeal/addOrUpdateUCarDealPayInfo.do',
                beforeSend: function () {
                    wait_dialog = $.ligerDialog.SQalert({content: LogUtils.LOG_CMM_DATA_LOADING, SQ_type: "waitting"});
                },
                success: function (msg) {
                    wait_dialog.close();
                    if (msg.success == 1) {
                        top.$.ligerDialog.SQalert({
                            content: msg.info, SQ_showButtons: true, SQ_type: "success", onClose: function () {
                                frameElement.dialog.close();
                            }
                        });
                    } else {
                        top.$.ligerDialog.SQalert({content: msg.info, SQ_type: "error"});
                    }
                }
            });
        };

    })

</script>
</body>
</html>